package dev.projectnightfall.network;

import dev.projectnightfall.thread.IThread;

import java.io.InputStream;

/**
 * Class to handle the InputStream from the socket connected to the server.
 */
public class InputHandler implements IThread {

    /**
     * Main needed variables.
     */
    protected InputStream input;
    private boolean loopThread;

    /**
     * Constructor which assigns the variables and initialises the handler.
     *
     * @param inputStream InputStream from the socket.
     */
    public InputHandler(InputStream inputStream) {
        input = inputStream;
        loopThread = true;
    }

    /**
     * Halts the thread.
     */
    @Override
    public void stopThread() {
        loopThread = false;
    }

    /**
     * Method called when .start() is called.
     */
    @Override
    public void run() {
        do {
            //will handle on next commit
        } while (loopThread);
    }
}
